<?php
//$go_next = 1;//bien xac dinh xem NSD co the nhan vao cum tu trang sau duoc khong
//$v_number = $v_limit;// so bai viet hien thi trong mot trang
//$v_category_name = $arr_category_count_article['0']['2'];//Ten linh vuc
//$v_count = $arr_category_count_article['0']['3'];//So bai viet co trong linh vuc
$v_number_of_af = sizeof($arr_all_af); 	// So tthc lay ra duoc
$v_current_style_name = "odd_row";
$v_next_style_name="";
?>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="page_title">
		<td colspan="2"><?php echo CONST_AF_SEARCH_BY_AGENCY_LABEL." >> ".$v_name_agency; ?></td>
	</tr>
	<tr class="category_title">
		<td colspan="2"><?php echo $v_name_cate." (".$v_total_af_count.")";?></td>
	</tr>		
	<tr><td height="10"></td></tr>
</table><?php

if ($v_number_of_af>0){?>
	<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
		<col width="10%"><col width="85%"><col width="5%">		
	<tr class="header">
		<td align="center"><?php echo CONST_AF_ORDER; ?></td>
		<td align="center"><?php echo CONST_AF_NAME_LABEL; ?></td>
	</tr>
		<?php
		$stt=($page-1)*$limit;	
		for($v_index = 0; $v_index < $v_number_of_af ; $v_index++){
			//$v_af_stt= $arr_all_af[$v_index]['0'];
			$v_af_id = $arr_all_af[$v_index]['0'];
			$v_af_name = $arr_all_af[$v_index]['1'];			
			$v_url = "index.php?fuseaction=DISPLAY_SINGLE_AF&v_session=".$v_session."&af_id=" . $v_af_id;
						
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}
			
			$stt += 1;
			?>		
				<tr class="<?php echo $v_current_style_name ?>"> 
					<td align="center">
						<a href="<?php echo $v_url;?>"><?php echo $stt;?></a>
					</td>				
					<td align="left">
					<img src="<?php echo $_ISA_IMAGE_URL_PATH?>doc.gif">
						<a href="<?php echo $v_url;?>"><?php echo $v_af_name;?></a>
					</td>					
				</tr>			
			<?php 
		}
		
	if ($v_current_style_name == "odd_row"){
	$v_next_style_name = "round_row";
	}else{
		$v_next_style_name = "odd_row";
	}
		echo _add_empty_row($v_number_of_af,CONST_LIMIT_AF_PAGE,$v_current_style_name,$v_next_style_name,2);
		?>
	</table>
<?php
}else{
		echo CONST_NO_AF_MESSAGE;
}?>
<table>
<tr>
	<col width="5%"><col width="95%">
<td align="center" class="normal_label">
<b>
<?

if ($v_total_af_count > $v_limit) 
{//(*)

if ($page == 1)  
	echo "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-left.jpg class=normal_image align=center>"; 
else            
	echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_CATE&v_session=".$v_session."&category_id=" .$v_category_id. "&agency_id=".$v_agency_id."&page=".($page - 1). "\">". "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-left.jpg class=normal_image align=center>" . "</a>";

for ($i = 1; $i <= $pager->numPages; $i++) { 
	echo " | "; 
	if ($i == $pager->page)
		echo $i; 
	else 
		 echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_CATE&v_session=".$v_session."&category_id=" .$v_category_id. "&agency_id=".$v_agency_id. "&page=". $i. "\">". $i."</a>";
    }//dong for

if ($page == $pager->numPages) 
	echo " | ". "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-right.jpg class=normal_image align=center>"; 
else            
	echo " | ". "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_CATE&v_session=".$v_session."&category_id=" .$v_category_id."&agency_id=".$v_agency_id. "&page=".($page + 1) . "\">" . "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-right.jpg class=normal_image align=center>" . "</a>";
}
?>
</b>
</td>
</tr>
</table>